<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>search</title>
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<!--标准mui.css-->
		<link rel="stylesheet" href="../css/mui.min.css">
		<!--App自定义的css-->
		<link rel="stylesheet" type="text/css" href="../css/app.css" />
		<link href="../css/mui.picker.css" rel="stylesheet" />
		<link href="../css/mui.poppicker.css" rel="stylesheet" />
		
		<script src="../js/mui.min.js"></script>
		<!--<script src="../js/mui.picker.min.js"></script>-->
		<script src="../js/mui.picker.js"></script>
		<script src="../js/mui.poppicker.js"></script>
		<script src="../js/city.data.js" type="text/javascript" charset="utf-8"></script>
		<script src="../js/city.data-3.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript" src="../js/jquery.min.js" ></script>
		<script type="text/javascript" src="../js/new-add-address.js" ></script>
		
	</head>
	<body>
		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 class="mui-title">添加地址</h1>
		</header>
		<div class="new-address">
			<form class="mui-input-group">
				<div class="mui-input-row">
					<label>收件人：</label>
					<input id="name" type="text" placeholder="请输入姓名">
				</div>
				<div class="mui-input-row">
					<label>手机号：</label>
					<input id="phone" type="text" class="mui-input-clear" placeholder="请输入手机号" data-input-clear="5"><span class="mui-icon mui-icon-clear mui-hidden"></span>
				</div>
				<div id="showCityPicker3">
					<label>所在地区：</label>
					<div id="cityResult3" class="ui-alert"></div>
				</div>
				<div class="mui-input-row">
					<label>详细地址：</label>
					<input id="addr" type="text" class="mui-input-clear" placeholder="请输入详细地址" data-input-clear="5"><span class="mui-icon mui-icon-clear mui-hidden"></span>
				</div>
			</form>
			<div class="mui-content">
				<ul class="mui-table-view">
					<li class="mui-table-view-cell">
						<span></span>
						<div class="mui-switch mui-switch-mini mui-active ">
							<div class="mui-switch-handle"></div>
						</div>
					</li>
					
				</ul>
			</div>
		</div>
		<div class="preservation"><a id="save">保存</a></div>
		
		<script>
			(function($, doc) {
				$.init();
				$.ready(function() {
					var cityPicker3 = new $.PopPicker({
						layer: 3
					});
					cityPicker3.setData(cityData3);
					var showCityPickerButton = doc.getElementById('showCityPicker3');
					var cityResult3 = doc.getElementById('cityResult3');
					showCityPickerButton.addEventListener('tap', function(event) {
						cityPicker3.show(function(items) {
							cityResult3.innerText = "" + (items[0] || {}).text + " " + (items[1] || {}).text + " " + (items[2] || {}).text;
							//返回 false 可以阻止选择框的关闭
							//return false;
						});
					}, false);
				});
			})(mui, document);
		</script>
		<script>
			mui.init({
				swipeBack:true //启用右滑关闭功能
			});
			mui('.mui-content .mui-switch').each(function() { 
				this.parentNode.querySelector('span').innerText = '设为默认：' + (this.classList.contains('mui-active') ? '' : '');
				
				this.addEventListener('toggle', function(event) {
					//event.detail.isActive 可直接获取当前状态
					this.parentNode.querySelector('span').innerText = '设为默认：' + (event.detail.isActive ? '' : '');
				});
			});
		</script>
	</body>
</html>
